from typing import List
from typing import Optional
from sqlalchemy import ForeignKey, Integer
from sqlalchemy import String
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine     
        
class Base(DeclarativeBase):
    pass

class trade_cal(Base):
    __tablename__ = "trade_cal"
    cal_date: Mapped[str] = mapped_column(String(10), primary_key=True)
    exchange: Mapped[str] = mapped_column(String(10), nullable=True)
    is_open: Mapped[int] = mapped_column(nullable=True)
    pretrade_date: Mapped[str] = mapped_column(String(10), nullable=True)
    
class stock_basic(Base):
    __tablename__ = "stock_basic"
    ts_code: Mapped[str] = mapped_column(String(10))
    symbol: Mapped[str] = mapped_column(String(10), primary_key=True)
    name: Mapped[str] = mapped_column(String(10))
    area: Mapped[str] = mapped_column(String(10))
    industry: Mapped[str] = mapped_column(String(10))
    market: Mapped[str] = mapped_column(String(10))
    exchange: Mapped[str] = mapped_column(String(10))
    list_status: Mapped[str] = mapped_column(String(10))
    list_date: Mapped[str] = mapped_column(String(10))
    delist_date: Mapped[str] = mapped_column(String(10))
    is_hs: Mapped[str] = mapped_column(String(10))
    

